# Contributor: Steeve Chailloux <steeve.chailloux@orus.io>
# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
pkgname=cabal
pkgver=3.2.0.0
pkgrel=0
pkgdesc="The Haskell Cabal"
url="https://haskell.org/"
arch="x86_64"
license="BSD-3-Clause"
depends="gmp zlib"
makedepends="ghc gmp-dev libffi-dev zlib-dev binutils-gold chrpath"
options="!check" # todo
source="https://hackage.haskell.org/package/cabal-install-$pkgver/cabal-install-$pkgver.tar.gz
	cabal-0001-force-ld.gold.patch
	ghc-8.8.patch
	"

builddir="$srcdir/$pkgname-install-$pkgver"

build() {
	# Note: we don't want to build profiling or shared libraries, that is why
	# EXTRA_CONFIGURE_OPTS is set
	env HOME="$builddir" EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh --jobs --no-doc
}

package() {
	install -m 755 -D dist/build/cabal/cabal "$pkgdir/usr/bin/cabal"
	chrpath -d "$pkgdir/usr/bin/cabal"

	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="ad937b2df42b688e4608aa2b91a25daf1042e5573626202e5182cbfeca9acc5933194853405a6396c60d0d28d6d0d5c5276fd85cb6acf4be2c8cd12afe747062  cabal-install-3.2.0.0.tar.gz
735a1aa9084d7eb7297076587cf2896af2951d4a2ecc20c5a6758a91c3751f5c212b65668befc25cfbc273633041543bda3da0fe9cee59795eeb3f40b3fb4922  cabal-0001-force-ld.gold.patch
8d6f9c770a9f2b24ca10b81235ae339385213c260712bcd65f19fc033d740d286ab30ff669a43e9aec63372937355e2c191fcf795a846c6291a10ff3895e6503  ghc-8.8.patch"
